package com.his.controller;


import com.his.entity.BillsRecord;
import com.his.entity.ResponseResult;
import com.his.service.IBillsRecordService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 医院账单流水表 前端控制器
 * </p>
 *
 * @author Demoon Liu
 * @since 2022-02-20
 */
@RestController
@Tag(name = "账单管理模块接口")
public class BillsRecordController {

    @Autowired
    private IBillsRecordService iBillsRecordService;

    @PostMapping("/bills/query")
    @Operation(summary = "根据门诊号查询账单信息", description = "输入门诊号，返回该账单信息")
    @ApiResponses(value = {
            @ApiResponse(responseCode = "200", description = "查询成功"),
            @ApiResponse(responseCode = "250", description = "查询失败"),
    })
    public ResponseResult selectBillsByIdNo(@RequestBody BillsRecord billsRecord){
        return iBillsRecordService.selectBillsByIdNo(billsRecord);
    }

    @PostMapping("/bills/query1")
    @Operation(summary = "查询全部账单信息", description = "返回全部账单信息")
    @ApiResponses(value = {
            @ApiResponse(responseCode = "200", description = "查询成功"),
            @ApiResponse(responseCode = "250", description = "查询失败"),
    })
    public ResponseResult selectAllBills(){
        return iBillsRecordService.selectAllBills();
    }

    @PostMapping("/bills/update")
    @Operation(summary = "根据id更新账单信息", description = "修改Recordlist（缴费状态）")
    @ApiResponses(value = {
            @ApiResponse(responseCode = "200", description = "更新成功"),
            @ApiResponse(responseCode = "250", description = "更新失败"),
    })
    public ResponseResult updateBillsStatus(@RequestBody BillsRecord billsRecord){
        return iBillsRecordService.updateBillsStatus(billsRecord);
    }

    @PostMapping("/bills/insert")
    @Operation(summary = "插入账单信息", description = "除了Createtime字段，都需要插入")
    @ApiResponses(value = {
            @ApiResponse(responseCode = "200", description = "插入成功"),
            @ApiResponse(responseCode = "250", description = "插入失败"),
    })
    public ResponseResult insertBills(@RequestBody BillsRecord billsRecord){
        return iBillsRecordService.insertBills(billsRecord);
    }
}
